# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: laloch <laloch@atlas.cz>

pkgname=qt-gstreamer
pkgver=1.2.0
pkgrel=1
arch=(x86_64)
pkgdesc="Qt bindings for GStreamer"
url='http://gstreamer.freedesktop.org/modules/qt-gstreamer.html'
license=(LGPL2.1)
depends=(qt5-declarative gst-plugins-good)
makedepends=(cmake boost doxygen python)
conflicts=(qt5-gstreamer)
provides=(qt5-gstreamer)
replaces=(qt5-gstreamer)
source=("https://gstreamer.freedesktop.org/src/$pkgname/$pkgname-$pkgver.tar.xz"
	qt-gstreamer-1.6.patch::"http://cgit.freedesktop.org/gstreamer/qt-gstreamer/patch/?id=e2ca8094")
sha256sums=('9f3b492b74cad9be918e4c4db96df48dab9c012f2ae5667f438b64a4d92e8fd4'
            '82abf6564c36dcd944704c94a07894c976a1d4bd871cb378bdddf71422e2937f')

prepare() {
  mkdir -p build

# Fix build with gstreamer 1.6
  cd $pkgbase-$pkgver
  patch -p1 -i ../qt-gstreamer-1.6.patch
}

build() {
  cd build
  cmake ../$pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DQTGSTREAMER_EXAMPLES=OFF \
    -DQT_VERSION=5
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir" install
}
